﻿<!--revision $Id$-->
<Window x:Class="CurveChartControlTest.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:parts="clr-namespace:OpenWPFChart.Parts;assembly=OpenWPFChart.Parts"
    xmlns:ctrls="clr-namespace:OpenWPFChart.Controls;assembly=OpenWPFChart.Controls"
    xmlns:local="clr-namespace:CurveChartControlTest"
	DataContext="{Binding RelativeSource={RelativeSource Self}}"
	Name="window1"
    Title="OpenWPFChart Chart control test" SizeToContent="WidthAndHeight">
	
	<Window.Resources>
		<local:ItemCountToVisibilityConverter x:Key="ItemCountToVisibility"/>
	</Window.Resources>
	
	<DockPanel>
		<!-- Menu -->
		<Menu DockPanel.Dock="Top">
			<MenuItem Header="_File">
				<MenuItem Header="_Test Data">
					<MenuItem Header="_Items Tests">
						<MenuItem Header="_Hardcoded" Command="{Binding SelectTestCommand}" CommandParameter="Items_Hardcoded" />
						<MenuItem Header="_Polyline" Command="{Binding SelectTestCommand}" CommandParameter="Items_Polyline" />
						<MenuItem Header="_Bezier" Command="{Binding SelectTestCommand}" CommandParameter="Items_Bezier" />
					</MenuItem>
					<MenuItem Header="Items_Source Tests">
						<MenuItem Header="_Hardcoded" Command="{Binding SelectTestCommand}" CommandParameter="ItemsSource_Hardcoded" />
						<MenuItem Header="_Polyline" Command="{Binding SelectTestCommand}" CommandParameter="ItemsSource_Polyline" />
						<MenuItem Header="_Bezier" Command="{Binding SelectTestCommand}" CommandParameter="ItemsSource_Bezier" />
					</MenuItem>
				</MenuItem>
				<Separator/>
				<MenuItem Header="_Exit" Click="Exit_Click"/>
			</MenuItem>
			<MenuItem Header="_View">
				<MenuItem Header="_Clean selection" Click="mnuViewCleanSelection_Click"/>
				<Separator/>
				<MenuItem Header="Zoom_In (Ctrl+NumPad+)" Command="Zoom" CommandParameter="1.2"/>
				<MenuItem Header="Zoom_Out (Ctrl+NumPad-)" Command="Zoom" CommandParameter="-1.2"/>
			</MenuItem>
		</Menu>

		<Grid>
			<!-- Chart -->
			<ctrls:CurveChart Name="chart"
					 HorizontalScale="{Binding ElementName=window1, Path=HorizontalScale}"
					 VerticalScale="{Binding ElementName=window1, Path=VerticalScale}"
					 parts:Item.Click="chartItem_Click"
					 parts:Item.MouseEnterItem="chartItem_EnterItem"
					 parts:Item.MouseLeaveItem="chartItem_LeaveItem"
					 parts:Axis.FontWeight="Bold"
					 SnapsToDevicePixels="true"
					 >

				<parts:Axis.Pen>
					<Pen Brush="Green" Thickness="1"/>
				</parts:Axis.Pen>

				<parts:Grid.Pen>
					<Pen Brush="Green" Thickness="0.3">
						<Pen.DashStyle>
							<DashStyle Dashes="8,10,0,2"/>
						</Pen.DashStyle>
					</Pen>
				</parts:Grid.Pen>
			</ctrls:CurveChart>

			<!-- Legend -->
			<ctrls:ChartLegend
				ItemsSource="{Binding ElementName=chart, Path=Items}"
				SelectedItem="{Binding ElementName=chart, Path=SelectedItem}"
				IsSynchronizedWithCurrentItem="True"
				Visibility="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Items.Count,
					Converter={StaticResource ItemCountToVisibility}}"
				BorderBrush="LightGreen" BorderThickness="5" CornerRadius="5" Background="White"
				Margin="20" HorizontalAlignment="Right" VerticalAlignment="Top"
			/>
		</Grid>
	</DockPanel>
</Window>
